<template>
    <div
        class="container"
        @click="handleClick(item.id)"
    >
        <h1 class="title">
            <a>{{ item.title }}</a>
        </h1>
        <div class="describe">
            <a>{{ item.describe }}</a>
        </div>
        <p>Posted by ChenJianHui on {{ item.time }}</p>
    </div>
</template>

<script>
export default {
    name: "ArticleItem",
    props: {
        item: {
            type: Object,
            required: true,
        },
    },
    methods: {
        handleClick(id) {
            this.$router.push(`/details/${id}`);
        },
    },
};
</script>

<style scoped>
.container {
    gap: 20px;
    border: 1px solid #bfbfbf;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 10px 0 #f5f5f5;
    cursor: pointer;
}
.container:hover {
    box-shadow: 0 5px 10px 0 #ccc;
}
.title {
    margin: 0 0 10px;
}
.title a {
    font-size: 30px;
    font-weight: bold;
    color: #333;
}
.describe a {
    color: #a3a3a3;
    font-style: oblique;
}
.container a:hover {
    color: #0085a1;
}
.container p {
    font-style: italic;
    font-family: Lora, "Times New Roman", serif;
    margin: 8px 0;
    color: gray;
    font-size: 16px;
}

@media screen and (max-width: 600px) {
    .title a {
        font-size: 22px;
    }
}
</style>
